package com.gxm.模式.代理.动态.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class InvocationHandImpl implements InvocationHandler {
    //被代理对象
    private Object terget;
    public InvocationHandImpl(Object o){
        this.terget = o;
    }
    @Override
    public Object invoke(Object o, Method method, Object[] objects) throws Throwable {
        System.out.println("动态代理-开启事物");
        Object invoke = method.invoke(terget,objects);
        System.out.println("动态代理-提交事物");
        return invoke;
    }
}
